Skip to content

feat: TealTiger governance plugin for Dify - #425

Merged
nagasatish007 merged 5 commits into
agentguard-ai:mainfrom
lleonardo-franco:feat/dify-integration
Aug 3, 2026
Merged

feat: TealTiger governance plugin for Dify#425
nagasatish007 merged 5 commits into
agentguard-ai:mainfrom
lleonardo-franco:feat/dify-integration

Conversation

@lleonardo-franco

Copy link
Copy Markdown
Contributor

Closes #329. This PR introduces a Dify tool plugin for TealTiger Governance. It provides a visual node to scan text for policy violations and tracks cost via the TealTiger Python SDK.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an initial TealTiger “governance_scan” tool package intended for use as a Dify tool plugin, exposing a visual node configuration and a Python implementation that invokes TealTiger for a governance decision.

Changes:

  • Introduces Dify tool + provider metadata (manifest, provider credentials, tool definition YAML).
  • Implements governance_scan tool logic in Python using the TealTiger SDK.
  • Adds Python dependency declaration for the plugin package.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/dify-plugin-tealtiger/tools/governance_scan.yaml Defines the Dify tool’s identity and configuration parameters for governance scanning.
packages/dify-plugin-tealtiger/tools/governance_scan.py Implements the tool invocation logic using TealTiger’s Python SDK.
packages/dify-plugin-tealtiger/requirements.txt Declares the plugin’s Python dependency on tealtiger.
packages/dify-plugin-tealtiger/provider/tealtiger.yaml Declares the provider credential schema (api_key) for Dify.
packages/dify-plugin-tealtiger/manifest.yaml Registers the plugin/package metadata for Dify.
Suppressed comments (3)

packages/dify-plugin-tealtiger/tools/governance_scan.py:35

  • res.security is treated like a dict (.get(...)), but in TealTiger’s Python examples it’s accessed as an attribute (response.security.decision). As written, this will raise at runtime and fall into the exception handler, causing scans to DENY even when they should ALLOW. Also, returning security objects directly may not be JSON-serializable.
            res = client.chat.completions.create(
                model="gpt-4o-mini",
                messages=[{"role": "user", "content": content}]
            )
            

packages/dify-plugin-tealtiger/tools/governance_scan.py:29

  • This "governance scan" tool currently calls client.chat.completions.create(...), which invokes an LLM request. The linked Dify integration requirements in this repo describe a deterministic governance node with no LLM in the governance path (scan-only). Consider using TealTiger’s scan/evaluate APIs (e.g., TealGuard/TealEngine) so the tool can scan content without generating completions or incurring model cost/latency.
            if budget > 0:
                client_args["budget"] = budget
                
            client = TealOpenAI(**client_args)
            

packages/dify-plugin-tealtiger/tools/governance_scan.py:12

  • The tool currently (1) doesn’t fail fast with an actionable message when api_key is missing and (2) doesn’t wire secret scanning or budget limits into the TealTiger client, even though the tool’s description/requirements mention secrets and budget configuration. Consider validating credentials up front and passing secret_detection + budget into TealOpenAI.
        api_key = self.runtime.credentials.get("api_key")
        content = tool_parameters.get("content", "")
        pii_detection = tool_parameters.get("pii_detection", True)
        prompt_injection = tool_parameters.get("prompt_injection", True)
        content_moderation = tool_parameters.get("content_moderation", True)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1 to +4
from dify_plugin import Tool
from typing import Any, Dict
import os
from tealtiger import TealOpenAI
Comment on lines +31 to +36
- name: content_moderation
type: boolean
required: false
default: true
label:
en_US: Enable Content Moderation
@@ -0,0 +1 @@
tealtiger>=0.1.0
Copilot AI review requested due to automatic review settings August 1, 2026 19:43

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI review requested due to automatic review settings August 1, 2026 19:56

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@nagasatish007

Copy link
Copy Markdown
Contributor

Thanks @lleonardo-franco — Dify integration is a great addition (n8n + Dify gives TealTiger coverage across the two biggest visual AI workflow builders).

Quick check: did the latest commit address the tealtiger>=1.4.0 version pin and the missing secret_detection / budget YAML params that Copilot flagged? If so, LGTM — merging.

Copilot AI review requested due to automatic review settings August 2, 2026 13:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@lleonardo-franco

Copy link
Copy Markdown
Contributor Author

Yes, just pushed a new commit addressing those points!

  • Updated the tealtiger version pin to >=1.4.0 in requirements.txt.
  • Added the missing secret_detection parameter to both the YAML configuration and the Python tool logic (the budget parameter was already in place).

Thanks for the review, let me know if there's anything else!

Copilot AI review requested due to automatic review settings August 3, 2026 06:16

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review is ineligible. To be eligible to request a review, you need a paid Copilot license, or your organization must enable Copilot code review.

@nagasatish007
nagasatish007 merged commit da38b70 into agentguard-ai:main Aug 3, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Integration]: TealTiger governance plugin for Dify visual agent builder

3 participants